<script lang="ts" setup>
import { ref } from 'vue'
// import { showToast } from 'vant';
// import {useUserStore} from '@/stores/user'
import { useAddressStore } from '@/stores/address'

// import { onMounted } from 'vue'

import { useRouter } from 'vue-router'
const router = useRouter()
// const userStore = useUserStore()
const addressStore = useAddressStore()
const chosenAddressId = ref('1')

// const list = ref([])
const onClickLeft = () => history.back()
//编辑
const onEdit = (item: any) => {
  router.push(`/addressitem/?id=${item.addressid}`)
}

//获取地址列表
// const getAddressList = async () => {
//   addressStore.setAddList()
// }

// onMounted(() => {
//   getAddressList()
// })
</script>

<template>
  <van-nav-bar title="地址管理" left-text="返回" left-arrow @click-left="onClickLeft" />
  <van-address-list v-model="chosenAddressId" :list="addressStore.list" default-tag-text="默认" @add="router.push('/addressitem')" @edit="onEdit" />
</template>

<style scoped lang="less"></style>
